import {Character} from "./Character.js";

export class ZoeticCharacter extends Character{
  health

  maxHealth

  /**
   * 扣血
   * @param damage {number}
   */
  subHealth = (damage)=>{
    if (this.health < damage){
      this.die()
    }else{
      this.health -= damage
    }
  }

  /**
   * 加血
   * @param n 加血量
   * @return {boolean} 是否成功加血
   */
  addHealth = n =>{
    if (this.health === this.maxHealth){
      return false
    }

    this.health+=n
    this.health = Math.min(this.maxHealth,this.health)
    return true
  }

  die=()=>console.error("please implement methon onDie")
}